package com.apimarket.dao;

import com.apimarket.entity.SysMenu;
import com.apimarket.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import com.apimarket.entity.vo.SysUserMenuVo;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description:
 * @Author ZXR
 * @Date 2021/7/20 9:33
 * @Version 1.0
 */
@Repository
public interface SysUserMapper {
    //@Select("select * from sys_user where user_name=#{username}")
    SysUser selectByName(String username);

    List<SysMenu> selectMenuListByUser(Integer userId);

    void update(SysUser sysUser);

    List<SysMenu> selectMenuListByPath(String requestUrl);

    //根据父级菜单id查询所有的父菜单和他的子菜单
    List<SysUserMenuVo> findMenusByIds(@Param("menuIds")List<Integer> menuIds);

    int insertObject(SysUser entity);

    int deleteObject(String userName);

    int updateObject(SysUser entity);

    int validById(
            @Param("id")Integer id,
            @Param("enabled")Integer enabled
    );

    List<SysUser> findPageObjects(String username);

    int getRowCount(String username);

    Integer checkUserExist(String userName);

    Integer findRoleId(String roleName);

    List<SysUser> findUserByKongId(String id);
}
